package ru.spb.osll.myfit.client.widget;

import ru.spb.osll.myfit.common.Table;

import com.google.gwt.user.client.ui.TextBox;

public class MyFitTableWidget extends FlexTableWidget {

	public MyFitTableWidget(GWTWidgetFactory gwtWidgetFactory, Table table) {
		super(gwtWidgetFactory, table);
	}

	@Override
	protected void tuneMenu() {
		m_addCellItem.setVisible(true);
		m_deleteCellItem.setVisible(true);
	}

	@Override
	protected void setReadOnly(boolean isReadOnly) {
	  int rowCount = m_flexTable.getRowCount();
    for (int i = 0; i < rowCount; i++) {
      int cellCount = m_flexTable.getCellCount(i);
      for (int j = 0; j < cellCount; ++j) {
        try {
          TextBox tb =((TextBox) m_flexTable.getWidget(i, j));     
          tb.setReadOnly(isReadOnly);
        } catch (Exception ex) {
        }
      }
    }	
	}
}
